<?php
require_once '../func/admin_func.php';
$card = new admin();
if (isset($_POST['pager'])) {
    $pager = $_POST['pager'];
} else {
    $pager = 1;
}
$data = $card->GetCardList($pager);
$n = count($data);
$i = 0;
?>

<div id="main-wrapper">
    <h1>身份证信息管理</h1>
    <a class="search-button" href="#">高级搜索</a><div class="search-form" style="display: none;">
        <div class="wide form">
        </div>
    </div>
    <div id="user-account-grid" class="grid-view">
        <div class="summary">共<?php echo $m = $card->info_count('card'); ?>条.</div>
        <table class="items">
            <thead>
                <tr>
                    <th></th>
                    <th id="user-account-grid_c1"><a href="">ID</a></th>
                    <th id="user-account-grid_c2"><a href="">姓名</a></th>
                    <th id="user-account-grid_c3"><a href="">性别</a></th>
                    <th id="user-account-grid_c4"><a href="">身份证号</a></th>
                    <th id="user-account-grid_c4"><a href="">创建时间</a></th>
                    <th id="user-account-grid_c4"><a href="">操作</a></th>
                </tr>
            </thead>
            <tbody id="tbody">
                <?php
                while ($i < $n) {
                    ?>
                    <tr class="<?php if ($i % 2 == 0) {
                    echo "even";
                } else {
                    echo "odd";
                } ?>">
                        <td></td>
                        <td><?php echo $data[$i]['id']; ?></td>
                        <td><?php echo $data[$i]['name']; ?></td>
                        <td><?php echo $data[$i]['sex']; ?></td>
                        <td><?php echo $data[$i]['c_no']; ?></td>
                        <td><?php echo $data[$i]['creat_time']; ?></td>
                        <td>
                            <a class="update" title="更新" href="#" onclick="operate('card',<?php echo $data[$i]['id'] . "," . $pager; ?>,'update')" ><img src="./images/update.png" alt="更新"></a>
                            <a class="delete" title="删除" href="#" onclick="operate('card',<?php echo $data[$i]['id'] . "," . $pager; ?>,'del')" ><img src="./images/delete.png" alt="删除"></a></td></tr>
    <?php $i++;
} ?>
            </tbody>
        </table>
        <div class="pager">
            <script>$('.pager').load("./pager.php",{type:'card',pager:<?php echo $pager; ?>}); </script>
        </div>
    </div>